]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Overview: Remove invisible animations
authorAdel Gadllah <adel.gadllah@gmail.com>
Thu, 16 Dec 2010 19:21:12 +0000 (20:21 +0100)
committerAdel Gadllah <adel.gadllah@gmail.com>
Thu, 16 Dec 2010 19:24:08 +0000 (20:24 +0100)
Given that the grid view is gone there is no point in animating the
window previews on all workspaces anymore so just do it for the current
one avoid taking a slow down caused by animating windows on other workspaces.

https://bugzilla.gnome.org/show_bug.cgi?id=637353

js/ui/workspace.js

index 0f53380af88ae0b965c778990281ed2c81348e0a..600249294f92a661ebd3730d46605aa777b677d1 100644 (file)
@@ -396,7 +396,7 @@ WindowOverlay.prototype = {
     // These parameters are not the values retrieved with
     // get_transformed_position() and get_transformed_size(),
     // as windowClone might be moving.
-    // See Workspace._fadeInWindowOverlay
+    // See Workspace._showWindowOverlay
     updatePositions: function(cloneX, cloneY, cloneWidth, cloneHeight) {
         let button = this.closeButton;
         let title = this.title;
@@ -946,6 +946,9 @@ Workspace.prototype = {
         let slots = this._computeAllWindowSlots(visibleClones.length);
         visibleClones = this._orderWindowsByMotionAndStartup(visibleClones, slots);
 
+        let currentWorkspace = global.screen.get_active_workspace();
+        let isOnCurrentWorkspace = this.metaWorkspace == currentWorkspace;
+
         for (let i = 0; i < visibleClones.length; i++) {
             let slot = slots[i];
             let clone = visibleClones[i];
@@ -962,7 +965,7 @@ Workspace.prototype = {
 
             if (overlay)
                 overlay.hide();
-            if (animate) {
+            if (animate && isOnCurrentWorkspace) {
                 if (!metaWindow.showing_on_its_workspace()) {
                     /* Hidden windows should fade in and grow
                      * therefore we need to resize them now so they
@@ -992,13 +995,13 @@ Workspace.prototype = {
                                    time: Overview.ANIMATION_TIME,
                                    transition: 'easeOutQuad',
                                    onComplete: Lang.bind(this, function() {
-                                      this._fadeInWindowOverlay(clone, overlay);
+                                      this._showWindowOverlay(clone, overlay, true);
                                    })
                                  });
             } else {
                 clone.actor.set_position(x, y);
                 clone.actor.set_scale(scale, scale);
-                this._fadeInWindowOverlay(clone, overlay);
+                this._showWindowOverlay(clone, overlay, isOnCurrentWorkspace);
             }
         }
     },
@@ -1019,7 +1022,7 @@ Workspace.prototype = {
         }
     },
 
-    _fadeInWindowOverlay: function(clone, overlay) {
+    _showWindowOverlay: function(clone, overlay, fade) {
         if (clone.inDrag)
             return;
 
@@ -1041,17 +1044,21 @@ Workspace.prototype = {
 
         if (overlay) {
             overlay.updatePositions(cloneX, cloneY, cloneWidth, cloneHeight);
-            overlay.fadeIn();
+            if (fade)
+                overlay.fadeIn();
+            else
+                overlay.show();
         }
     },
 
-    _fadeInAllOverlays: function() {
+    _showAllOverlays: function() {
+        let currentWorkspace = global.screen.get_active_workspace();
         for (let i = 0; i < this._windows.length; i++) {
             let clone = this._windows[i];
             let overlay = this._windowOverlays[i];
             if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows))
                 continue;
-            this._fadeInWindowOverlay(clone, overlay);
+            this._showWindowOverlay(clone, overlay, this.metaWorkspace == currentWorkspace);
         }
     },
 
@@ -1087,7 +1094,7 @@ Workspace.prototype = {
 
     showWindowsOverlays: function() {
         this._windowOverlaysGroup.show();
-        this._fadeInAllOverlays();
+        this._showAllOverlays();
     },
 
     hideWindowsOverlays: function() {
@@ -1208,6 +1215,8 @@ Workspace.prototype = {
 
     // Animates the return from Overview mode
     zoomFromOverview : function() {
+        let currentWorkspace = global.screen.get_active_workspace();
+
         this.leavingOverview = true;
 
         this._hideAllOverlays();
@@ -1219,6 +1228,9 @@ Workspace.prototype = {
         this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this,
                                                                            this._doneLeavingOverview));
 
+        if (this._metaWorkspace == currentWorkspace)
+            return;
+
         // Position and scale the windows.
         for (let i = 0; i < this._windows.length; i++) {
             let clone = this._windows[i];